'\" te
.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CRYPT_GENSALT_IMPL 3C "Jun 10, 2002"
.SH NAME
crypt_gensalt_impl \- generate salt for password encryption
.SH SYNOPSIS
.LP
.nf
#include <crypt.h>

\fBchar *\fR\fBcrypt_gensalt_impl\fR(\fBchar *\fR\fIgsbuffer\fR, \fBsize_t\fR \fIgsbufflen\fR,
     \fBconst char *\fR\fIoldsalt\fR, \fBconst struct passwd *\fR\fIuserinfo\fR,
     \fBconst char **\fR\fIparams\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBcrypt_gensalt_impl()\fR function is called by \fBcrypt_gensalt\fR(3C) to
generate the salt for password encryption.
.sp
.LP
The \fIgsbuffer\fR argument is a pointer to an MT-safe buffer of size
\fIgsbufflen\fR.
.sp
.LP
The \fIoldsalt\fR and \fIuserinfo\fR arguments are passed unchanged from
\fBcrypt_gensalt\fR(3C).
.sp
.LP
The \fIparams\fR argument is an \fIargv\fR-like null terminated vector of type
\fBchar *\fR. The first element of \fIparams\fR represents the mechanism token
name from \fBcrypt.conf\fR(5). The remaining elements of \fIparams\fR represent
strings of the form <\fBparameter\fR>[=<\fBvalue\fR>] to allow passing in
additional information from the \fBcrypt.conf\fR entry, such as specifying
rounds information "\fBrounds=4096\fR".
.sp
.LP
The value returned by \fBcrypt_gensalt_impl()\fR points to a thread-specific
buffer to be freed by the caller of \fBcrypt_gensalt\fR(3C) after calling
\fBcrypt\fR(3C).
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBcrypt_gensalt_impl()\fR returns a pointer to the
new salt. Otherwise a null pointer is returned and \fBerrno\fR is set to
indicate the error.
.SH ERRORS
.sp
.LP
The \fBcrypt_gensalt_impl()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 11n
The configuration file \fBcrypt.conf\fR contains an invalid entry.
.RE

.sp
.ne 2
.na
\fB\fBELIBACC\fR\fR
.ad
.RS 11n
The required crypt shared library was not found.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 11n
There is insufficient memory to perform hashing.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR passwd (1),
.BR crypt (3C),
.BR crypt_genhash_impl (3C),
.BR crypt_gensalt (3C),
.BR getpassphrase (3C),
.BR crypt.conf (5),
.BR passwd (5),
.BR attributes (7)
